//
//  HistoryDataBase.h
//  SIPphone
//
//  Created by wrt on 13-12-16.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SIPInterface.h"
#import <sqlite3.h>

//历史纪录的宏定义
#define TABLE_NAME @"historyTable"
#define CALL_TIME @"callTime"
#define CALL_NUMBER @"callNumber"
#define CALL_STATUS @"callStatus"
#define CALL_DISPLAYNAME @"callDisPlayName"

@interface HistoryDataBase : NSObject
{
    sqlite3 *db;
}

//存储从数据库获取出来的时间字符
@property (nonatomic, strong) NSString *tempTime;
//存储从数据库获取出来的号码字符
@property (nonatomic, strong) NSString *tempNumber;
//存储从数据库获取出来的状态字符
@property (nonatomic, strong) NSString *tempStatus;
//存储从数据库获取出来的昵称字符
@property (nonatomic, strong) NSString *tempDisplayName;


@property (nonatomic, strong) NSMutableArray *timeArray;
//读取出来的号码数组
@property (nonatomic, strong) NSMutableArray *numberArray;
//读取出来的状态数组
@property (nonatomic, strong) NSMutableArray *statusArray;
//读取出来的昵称数组
@property (nonatomic, strong) NSMutableArray *displayNameArray;

//定义表名的属性
@property (strong, nonatomic) NSString *tableNameForUser;

//单例的初始化方法
+ (HistoryDataBase *)shareHistoryDataBase;
//创建数据库
- (void)createDb;
//未接形式存数据库
- (void)callincomingNotAnswer;
//已接形式存数据库
- (void)callincomingAnswer;
//读取数据库，并将其存入对应数组中
- (void)loadArray:(int)a;
//写进数据库的操作
- (void)writeIntoDatabaseWithNumber:(NSString *)number andDisplayName:(NSString *)displayName;
//删除数据库全部内容
- (void)removeAlldata;
//删除单个数据
- (void)deleteWithTime:(NSString *)time;
//删除没有时间数据和状态的数据
- (void)deleteNULLDataWithTime;
//删除超出指定条数据的旧数据(按时间排序)
- (void)deleteExceedData:(int)i;
//切换表名
- (void)changeTableName:(NSString *)userName;

@end
